package com.sky.context;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class BaseContext {

    private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void setCurrentId(Long id) {
//        log.info("当前线程id+"+Thread.currentThread().getId());
//        log.info("当前Threadlocal info:" + BaseContext.info());
        threadLocal.set(id);

    }

    public static String info(){
        return threadLocal.toString();
    }
    public static Long getCurrentId() {
//        log.info("当前线程id+"+Thread.currentThread().getId());
//        log.info("当前Threadlocal info:" + BaseContext.info());
        return threadLocal.get();
    }

    public static void removeCurrentId() {
        threadLocal.remove();
    }

}
